﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NguyenHoa.Web.App_Code;

using NguyenHoa.Domains;
using NguyenHoa.Services;

namespace NguyenHoa.Web.Controls
{
  public partial class VideoClip : BaseControl
  {
    #region Variables and properties
    protected string Content_Video = string.Empty;
    #endregion

    #region Methods
    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {
        LoadVideo();
      }
    }

    private void LoadVideo() {
      TList<Multimedia> vlist = new MultimediaService().GetVideoByStatus(VisibleStatus.Active);
      if (vlist.Count > 0) {
        string host = "http://" + Request.Url.Host + ":" + Request.Url.Port + Request.ApplicationPath;
        string file = host + "/Upload/Video/" + vlist[0].Path;
        Content_Video = Utils.EmbedObject(file, "165", "160", vlist[0].Id.ToString());
      }
    }

    #endregion
  }
}